package com.farmer.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.farmer.mapper.RoleMapper;
import com.farmer.pojo.Admin;
import com.farmer.pojo.Menu;
import com.farmer.pojo.Role;
import com.farmer.service.RoleService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 86183
 * @description 针对表【role】的数据库操作Service实现
 * @createDate 2024-05-06 17:22:51
 */
@Service
public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements RoleService {

    @Override
    public List<Menu> selectMenusByRoleId(Integer roleId) {
        return this.getBaseMapper().selectMenusByRoleId(roleId);
    }

    @Override
    public List<Admin> selectAdminByRoleId(Integer roleId) {
        return this.getBaseMapper().selectAdminByRoleId(roleId);
    }

    @Override
    public void deleteRoleMenusAndAdmins(Integer roleId) {
        this.baseMapper.deleteRoleMenus(roleId);
        this.baseMapper.deleteAdminRole(roleId);
    }
}




